package com.ruoyi.courseManagement.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.courseManagement.domain.Course;
import com.ruoyi.courseManagement.domain.vo.CourseVO;
import com.ruoyi.courseManagement.mapper.CourseMapper;
import com.ruoyi.courseManagement.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 课程列表Service业务层处理
 * 
 * @author liao
 * @date 2025-06-09
 */
@Service
public class CourseServiceImpl implements CourseService
{
    @Autowired
    private CourseMapper courseMapper;

    /**
     * 查询课程列表
     * 
     * @param courseId 课程列表主键
     * @return 课程列表
     */
    @Override
    public Course selectCourseByCourseId(Integer courseId)
    {
        return courseMapper.selectCourseByCourseId(courseId);
    }

    /**
     * 查询课程列表列表
     * 
     * @param courseVO 课程列表
     * @return 课程列表
     */
    @Override
    public List<CourseVO> selectCourseList(CourseVO courseVO)
    {
        return courseMapper.selectCourseList(courseVO);
    }

    /**
     * 新增课程列表
     * 
     * @param course 课程列表
     * @return 结果
     */
    @Override
    public int insertCourse(Course course)
    {
        course.setCreateTime(DateUtils.getNowDate());
        return courseMapper.insertCourse(course);
    }

    /**
     * 修改课程列表
     * 
     * @param course 课程列表
     * @return 结果
     */
    @Override
    public int updateCourse(Course course)
    {
        course.setUpdateTime(DateUtils.getNowDate());
        return courseMapper.updateCourse(course);
    }

    /**
     * 批量删除课程列表
     * 
     * @param courseIds 需要删除的课程列表主键
     * @return 结果
     */
    @Override
    public int deleteCourseByCourseIds(Integer[] courseIds)
    {
        return courseMapper.deleteCourseByCourseIds(courseIds);
    }

    /**
     * 删除课程列表信息
     * 
     * @param courseId 课程列表主键
     * @return 结果
     */
    @Override
    public int deleteCourseByCourseId(Integer courseId)
    {
        return courseMapper.deleteCourseByCourseId(courseId);
    }
}
